package com.qf.business.classes.listener;

import com.qf.commons.event.apply.consumer.EventHandler;
import com.qf.commons.event.apply.consumer.IEventHandler;
import com.qf.commons.event.entity.QphoneMessage;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;

/**
 * description:
 * author: Ken
 * 公众号：Java架构栈
 */
@EventHandler(value = "get-stu", isAsync = true)
@Component
public class MsgListener implements IEventHandler<String> {

    @Override
    public void handler(String eventContent, QphoneMessage qphoneMessage) {
        System.out.println("----------------------------------");
        System.out.println(Thread.currentThread().getName() + " get-stu - 接收到消息：" + eventContent);
        System.out.println("消息的发送时间：" + new SimpleDateFormat("HH:mm:ss").format(qphoneMessage.getSendTime()));
        System.out.println("消息的接收时间：" + new SimpleDateFormat("HH:mm:ss").format(qphoneMessage.getRecivTime()));
    }
}
